"use strict";(self.webpackChunkpromptmanager=self.webpackChunkpromptmanager||[]).push([[4426],{41383:function(e,n,t){t.d(n,{D1:function(){return E},ZP:function(){return C}});var i=t(29439),o=t(1413),r=t(72791),s=(t(38399),t(90493)),l=t(15021),a=t(94070),A=t(64554),u=t(43896),d=t(13239),c=t(83449),g=t(47283),h=t(82851),p=(t(73905),t(92205),t(61979)),B=t(26577),f=t(57697),x=t(67438),m=t(80184),v=(0,p.Z)({typography:{fontFamily:"Lato, sans-serif",fontSize:14,color:"#000"},components:{MuiFormControl:{styleOverrides:{root:{"& .Mui-disabled":{color:"#000"}}}},MuiImageList:{styleOverrides:{root:{width:"100% !important",height:"100% !important"}}},MuiListItemText:{styleOverrides:{root:{whiteSpace:"pre-wrap"}}},MuiImageListItem:{styleOverrides:{img:{width:"auto",height:"auto"}}}}});function E(e){var n,t=(null===(n=e.runError)||void 0===n?void 0:n.errors)||[];return(0,m.jsx)(s.Z,{children:t.map((function(e){return(0,m.jsx)(l.ZP,{children:(0,m.jsx)(a.Z,{severity:"error",children:e})},e)}))})}function w(e){var n=(0,o.Z)({},e.formData||{});return null!==n&&void 0!==n&&n.api_response&&delete n.api_response,Object.keys((null===e||void 0===e?void 0:e.formData)||{}).length>0?(0,m.jsx)(f.Z,{validator:B.Z,schema:e.schema,uiSchema:e.uiSchema,formData:n,readonly:!0,theme:v,className:"output-form"}):(0,m.jsx)(x.H,{emptyMessage:"No output"})}function C(e){var n=r.useState("form"),t=(0,i.Z)(n,2),s=t[0],l=t[1];return(0,m.jsx)(A.Z,{sx:{width:"100%"},children:(0,m.jsxs)(c.ZP,{value:s,children:[(0,m.jsx)(A.Z,{sx:{borderBottom:1,borderColor:"divider"},children:(0,m.jsx)(g.Z,{onChange:function(e,n){l(n)},"aria-label":"Output form tabs",children:(0,m.jsx)(u.Z,{label:"Output",value:"form"})})}),(0,m.jsx)(h.Z,{value:"form",sx:{padding:"4px"},children:e.loading?(0,m.jsx)(d.Z,{}):(0,m.jsxs)(A.Z,{children:[(0,m.jsx)(w,(0,o.Z)({},e)),(0,m.jsx)(E,(0,o.Z)({},e))]})})]})})}},6608:function(e,n,t){t.d(n,{Z:function(){return E}});var i=t(1413),o=t(45987),r=t(29439),s=t(27135),l=t(71502),a=t(57697),A=t(26577),u=t(72791),d=t(24518),c=t(80184),g=["node"],h=["node"],p=["node"],B=["node"],f=["node"],x=["node"],m=["node"];function v(e){var n=(0,u.useState)({}),t=(0,r.Z)(n,2),i=t[0],o=t[1],s=(0,u.useState)(!1),l=(0,r.Z)(s,2),g=l[0],h=l[1];try{var p=JSON.parse(e.children[0]);return(0,c.jsx)(a.Z,{schema:p,formData:i,validator:A.Z,onChange:function(e){o(e.formData)},submitBtn:(0,c.jsx)(d.Z,{variant:"contained",onClick:function(){h(!0),e.onFormSubmit(i)},disabled:g,children:"Submit"})})}catch(B){console.log(B)}return(0,c.jsx)("div",{children:"Unable to render form"})}function E(e){return(0,c.jsx)(s.D,(0,i.Z)((0,i.Z)({},e),{},{remarkPlugins:[l.Z],components:{img:function(e){e.node;var n=(0,o.Z)(e,g),t=n.alt,s=n.src,l=t.split("|"),a=(0,r.Z)(l,2),A=a[0],u=a[1],d={};try{d=JSON.parse(u)}catch(h){}return s.startsWith("data:audio/")||"Audio"===A?(0,c.jsx)("audio",{controls:!0,style:(0,i.Z)((0,i.Z)({},{display:"block"}),d),src:s,autoPlay:!0,children:" "}):s.endsWith(".mp4")||s.endsWith(".webm")||s.endsWith(".ogg")?(0,c.jsx)("video",{controls:!0,style:(0,i.Z)((0,i.Z)({},{display:"block",maxWidth:"100%",boxShadow:"0px 0px 10px 1px #7d7d7d"}),d),src:s,children:"Unable to load video"}):(0,c.jsx)("img",{src:s||"",alt:A,style:(0,i.Z)((0,i.Z)({},{display:"block",maxWidth:"100%",boxShadow:"0px 0px 10px 1px #7d7d7d"}),d)})},a:function(e){e.node;var n=(0,o.Z)(e,h);return(0,c.jsx)("a",(0,i.Z)((0,i.Z)({},n),{},{target:"_blank",rel:"noreferrer nofollow",children:n.children}))},table:function(e){e.node;var n=(0,o.Z)(e,p);return(0,c.jsx)("table",(0,i.Z)((0,i.Z)({style:{borderCollapse:"collapse",border:"1px solid #ccc"}},n),{},{children:n.children}))},tr:function(e){e.node;var n=(0,o.Z)(e,B);return(0,c.jsx)("tr",(0,i.Z)((0,i.Z)({},n),{},{style:{border:"1px solid #ccc"},children:n.children}))},th:function(e){e.node;var n=(0,o.Z)(e,f);return(0,c.jsx)("th",(0,i.Z)((0,i.Z)({},n),{},{style:{border:"1px solid #ccc"},children:n.children}))},td:function(e){e.node;var n=(0,o.Z)(e,x);return(0,c.jsx)("td",(0,i.Z)((0,i.Z)({},n),{},{style:{border:"1px solid #ccc"},children:n.children}))},code:function(n){n.node;var t=(0,o.Z)(n,m);return"language-function_form"===t.className?(0,c.jsx)(v,(0,i.Z)({onFormSubmit:e.onFormSubmit},t)):(0,c.jsx)("code",(0,i.Z)((0,i.Z)({},t),{},{children:t.children}))}},children:e.children||""}))}},74765:function(e,n,t){t.d(n,{F:function(){return Z}});var i=t(29439),o=t(1413),r=t(72791),s=t(24518),l=t(61979),a=t(57012),A=t(61889),u=t(13239),d=t(72601),c=t(39585),g=t(41383),h=t(6608),p=t(979),B=t(72397),f=t(26577),x=t(55519),m=t(55100),v=t(80184),E=(0,l.Z)({components:{MuiInputBase:{defaultProps:{autoComplete:"off"}},MuiTextField:{defaultProps:{variant:"outlined"},styleOverrides:{root:{"& .MuiOutlinedInput-root":{"& > fieldset":{border:"1px solid #ccc"}}}}}}});function w(e){return(0,v.jsx)(c.Z,(0,o.Z)({},e))}function C(e){return(0,v.jsx)(m.Z,(0,o.Z)({},e))}function Z(e){var n,t,l,c,m,Z=e.app,j=e.ws,Q=(0,d._)(null===Z||void 0===Z||null===(n=Z.data)||void 0===n?void 0:n.input_fields),y=Q.schema,I=Q.uiSchema,S=(0,r.useState)(null),F=(0,i.Z)(S,2),b=F[0],D=F[1],G=(0,r.useState)(null),M=(0,i.Z)(G,2),k=M[0],U=M[1],Y=(0,r.useState)(!1),R=(0,i.Z)(Y,2),N=R[0],H=R[1],O=(0,r.useState)({}),W=(0,i.Z)(O,2),J=W[0],K=W[1],L=(0,r.useState)(null),P=(0,i.Z)(L,2),q=P[0],T=P[1],V=new x.Kj,z=V.parse((null===Z||void 0===Z||null===(t=Z.data)||void 0===t||null===(l=t.output_template)||void 0===l?void 0:l.markdown)||""),X=(0,r.useRef)({}),_=(0,r.useRef)(!1);j&&j.setOnMessage((function(e){var n=JSON.parse(e.data);n.output&&(X.current=(0,d.P)(X.current,n.output)),_.current||!n.session&&!n.errors||(_.current=!0),n.session&&D(n.session.id),n.event&&"done"===n.event&&(_.current=!1,H(!1)),n.errors&&n.errors.length>0&&(T({errors:n.errors}),H(!1)),V.render(z,X.current).then((function(e){U(e)}))}));return(0,v.jsxs)("div",{style:{maxWidth:1200,margin:"0 auto",width:"100%",padding:"0 10px",textAlign:"left"},children:[(0,v.jsx)(p.b,{text:null===(c=Z.data)||void 0===c||null===(m=c.config)||void 0===m?void 0:m.input_template}),(0,v.jsx)(a.Z,{theme:E,children:(0,v.jsx)(B.ZP,{schema:y,uiSchema:(0,o.Z)((0,o.Z)({},I),{"ui:submitButtonOptions":{props:{disabled:N}}}),validator:f.Z,formData:J,onSubmit:function(e){var n,t=e.formData;N?(j.send(JSON.stringify({event:"stop",session_id:b})),H(!1)):(K(t),n=t,H(!0),T(null),_.current=!1,X.current={},j.send(JSON.stringify({event:"run",input:n,session_id:b})),H(!0))},templates:{ButtonTemplates:{SubmitButton:function(e){var n,t,i,r,l=(null===(n=e.uiSchema["ui:submitButtonOptions"])||void 0===n?void 0:n.submitText)||"Submit",a=(null===(t=e.uiSchema["ui:submitButtonOptions"])||void 0===t||null===(i=t.props)||void 0===i?void 0:i.style)||{};return null!==(r=e.uiSchema["ui:submitButtonOptions"])&&void 0!==r&&r.norender?null:(0,v.jsx)(s.Z,{size:"medium",variant:"contained",type:"submit",sx:(0,o.Z)((0,o.Z)({textTransform:"none"},a),{},{backgroundColor:N?"grey":"primary"}),children:N?"Cancel":l})}}},widgets:{FileWidget:w,voice:C}})}),(0,v.jsxs)("div",{style:{marginTop:50},children:[N&&!_.current&&!q&&(0,v.jsx)(A.ZP,{sx:{margin:"auto",textAlign:"center"},children:(0,v.jsx)(u.Z,{})}),(0,v.jsx)(h.Z,{className:"webapp-output",children:k}),q&&(0,v.jsx)(g.D1,{runError:q})]})]})}},43763:function(e,n,t){t.d(n,{$:function(){return b}});var i=t(4942),o=t(93433),r=t(29439),s=t(1413),l=t(72791),a=t(93044),A=t(49877),u=t(53767),d=t(61889),c=t(81918),g=t(61979),h=t(57012),p=t(55519),B=t(26577),f=t(72397),x=t(85172),m=t(23104),v=t(39585),E=t(55100),w=t(72601),C=t(979),Z=t(41383),j=t(6608),Q=t(80184);function y(e){return(0,Q.jsx)(v.Z,(0,s.Z)({},e))}function I(e){return(0,Q.jsx)(E.Z,(0,s.Z)({},e))}var S=function(e){var n=e.message,t=e.app;try{return"bot"===n.role?n.content:1===Object.keys(n.content).length?Object.keys(n.content).map((function(e){return n.content[e]})).join("\n\n"):Object.keys(n.content).map((function(e){var i,o,r=null===t||void 0===t||null===(i=t.data)||void 0===i||null===(o=i.input_fields)||void 0===o?void 0:o.find((function(n){return n.name===e}));return"**".concat(e,"**: ").concat(!r||"file"!==r.type&&"voice"!==r.type&&"image"!==r.type?n.content[e]:n.content[e].split(",")[0].split(";")[1].split("=")[1])})).join("\n\n")}catch(i){return""}},F=l.memo((function(e){var n,t,i,o,r=e.message,s=e.index,l=e.app,A=e.onInMessageFormSubmit;return(0,Q.jsxs)("div",{style:"bot"===r.role?{display:"flex",textAlign:"left",fontSize:16,padding:3}:{textAlign:"right"},children:["bot"===r.role&&(null===l||void 0===l||null===(n=l.data)||void 0===n||null===(t=n.config)||void 0===t?void 0:t.assistant_image)&&(0,Q.jsx)(a.Z,{src:null===(i=l.data)||void 0===i||null===(o=i.config)||void 0===o?void 0:o.assistant_image,alt:"Bot",style:{margin:"16px 8px 16px 0px"}}),"bot"===r.role&&r.content.length<=1&&(0,Q.jsxs)("div",{className:"chat_message_from_bot typing-indicator",children:[(0,Q.jsx)("span",{}),(0,Q.jsx)("span",{}),(0,Q.jsx)("span",{})]}),(0,Q.jsx)(j.Z,{className:"chat_message_from_".concat(r.role," ").concat(r.error?"error":""),onFormSubmit:A,children:S({message:r,app:l})})]},s)}));function b(e){var n,t,v,E,j,S,b,D,G,M,k,U,Y,R,N,H,O,W,J,K,L,P,q,T,V,z,X,_,$,ee,ne,te,ie=e.app,oe=e.isMobile,re=e.embed,se=void 0!==re&&re,le=e.ws,ae=(0,w._)(null===ie||void 0===ie||null===(n=ie.data)||void 0===n?void 0:n.input_fields),Ae=ae.schema,ue=ae.uiSchema,de=(0,l.useState)({}),ce=(0,r.Z)(de,2),ge=ce[0],he=ce[1],pe=(0,l.useState)(null),Be=(0,r.Z)(pe,2),fe=Be[0],xe=Be[1],me=(0,l.useState)([]),ve=(0,r.Z)(me,2),Ee=ve[0],we=ve[1],Ce=(0,l.useState)(null),Ze=(0,r.Z)(Ce,2),je=Ze[0],Qe=Ze[1],ye=(0,l.useState)(!se),Ie=(0,r.Z)(ye,2),Se=Ie[0],Fe=Ie[1],be=(0,l.useState)({backgroundColor:null===ie||void 0===ie||null===(t=ie.data)||void 0===t||null===(v=t.config)||void 0===v?void 0:v.window_color,color:"white",position:"fixed",right:16,bottom:16}),De=(0,r.Z)(be,2),Ge=De[0],Me=De[1],ke=new p.Kj,Ue=ke.parse((null===ie||void 0===ie||null===(E=ie.data)||void 0===E||null===(j=E.output_template)||void 0===j?void 0:j.markdown)||""),Ye=(0,l.useRef)({}),Re=(0,l.useRef)([]),Ne=(0,l.useRef)(null),He=(0,l.useRef)(!0),Oe=(0,g.Z)({components:{MuiInputBase:{defaultProps:{autoComplete:"off"}},MuiTextField:{defaultProps:{variant:"outlined"},styleOverrides:{root:{"& .MuiOutlinedInput-root":{"& > fieldset":{border:"1px solid ".concat((null===ie||void 0===ie||null===(S=ie.data)||void 0===S?void 0:S.config.window_color)||"#ccc")},"&.Mui-focused > fieldset":{border:"1px solid #0f477e"},"&:hover > fieldset":{border:"1px solid #0f477e"},"&.Mui-error > fieldset":{border:"1px solid #fcc"}}}}},MuiTypography:{styleOverrides:{caption:{fontSize:"0.7rem",marginLeft:2,color:"#666"}}},MuiButtonBase:{styleOverrides:{root:{"&.MuiButton-contained":{textTransform:"none"}}}}}});(0,l.useEffect)((function(){if(se)if(document.body.style="background: transparent",document.getElementsByClassName("ant-layout")[0].style="background: transparent",Se){var e=navigator.userAgent||navigator.vendor||window.opera,n=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(e),t=n?"100%":"400px",i=n?"90vh":"700px";window.parent.postMessage({width:t,height:i,type:"promptly-embed-open"},"*")}else setTimeout((function(){var e,n;window.parent.postMessage({type:"promptly-embed-resize",width:(null===Ne||void 0===Ne||null===(e=Ne.current)||void 0===e?void 0:e.clientWidth)||"auto",height:(null===Ne||void 0===Ne||null===(n=Ne.current)||void 0===n?void 0:n.clientHeight)||"auto"},"*")}),500),window.parent.postMessage({type:"promptly-embed-close"},"*")}),[se,Se]),(0,l.useEffect)((function(){var e,n,t,i,o,r,l,a;null!==ie&&void 0!==ie&&null!==(e=ie.data)&&void 0!==e&&null!==(n=e.config)&&void 0!==n&&n.welcome_message&&0===Ee.length&&we([{role:"bot",content:null===(l=ie.data)||void 0===l||null===(a=l.config)||void 0===a?void 0:a.welcome_message}]);if(null!==ie&&void 0!==ie&&null!==(t=ie.data)&&void 0!==t&&null!==(i=t.config)&&void 0!==i&&i.chat_bubble_text&&null!==ie&&void 0!==ie&&null!==(o=ie.data)&&void 0!==o&&null!==(r=o.config)&&void 0!==r&&r.chat_bubble_style&&0===Ee.length)try{var A,u,d=JSON.parse(null===ie||void 0===ie||null===(A=ie.data)||void 0===A||null===(u=A.config)||void 0===u?void 0:u.chat_bubble_style);Me((function(e){return(0,s.Z)((0,s.Z)({},e),d)}))}catch(c){console.error(c)}}),[ie,Ee.length]),le&&le.setOnMessage((function(e){var n=null,t=JSON.parse(e.data);if(t.output&&(Ye.current=(0,w.P)(Ye.current,t.output)),t.event&&"done"===t.event)He.current=!0;else{var i;if(He.current||!t.session&&!t.errors||(He.current=!0),t.session)xe(null===(i=t.session)||void 0===i?void 0:i.id);t.errors&&t.errors.length>0&&(n=t.errors.join("\n\n")),ke.render(Ue,Ye.current).then((function(e){""===e.trim()&&null===n&&(n="No response from AI. Please try again."),Re.current=[].concat((0,o.Z)(Re.current.slice(0,-1)),[{role:"bot",content:null!==n?n||"Unknown error occured. Please try again.":e.trim(),error:null!==n}]),we(Re.current),n=null}))}}));var We=function(e){Qe(null),we([].concat((0,o.Z)(Ee),[{role:"user",content:e}])),He.current=!1,Ye.current={},Re.current=[].concat((0,o.Z)(Ee),[{role:"user",content:e},{role:"bot",content:""}]),le.send(JSON.stringify({event:"run",input:e,session_id:fe}))};return(0,l.useEffect)((function(){var e=document.getElementById("messages");e.scrollTop=e.scrollHeight}),[Ee]),(0,Q.jsxs)(Q.Fragment,{children:[se&&(0,Q.jsx)(A.Z,{style:Ge,onClick:function(){return Fe(!Se)},variant:null!==ie&&void 0!==ie&&null!==(b=ie.data)&&void 0!==b&&null!==(D=b.config)&&void 0!==D&&D.chat_bubble_text?"extended":"circular",ref:Ne,children:Se?(0,Q.jsx)(x.Z,{}):null!==ie&&void 0!==ie&&null!==(G=ie.data)&&void 0!==G&&null!==(M=G.config)&&void 0!==M&&M.chat_bubble_text?(0,Q.jsx)("span",{children:null===ie||void 0===ie||null===(k=ie.data)||void 0===k||null===(U=k.config)||void 0===U?void 0:U.chat_bubble_text}):(0,Q.jsx)(m.Z,{})}),(0,Q.jsxs)("div",{className:"chat-container ".concat(se?"embedded":""," ").concat(Se?"maximized":"minimized"),style:{width:oe?"90%":"100%"},children:[se&&(0,Q.jsxs)("div",{style:{display:"flex",backgroundColor:null===ie||void 0===ie||null===(Y=ie.data)||void 0===Y?void 0:Y.config.window_color,borderRadius:"8px 8px 0px 0px"},children:[(null===ie||void 0===ie||null===(R=ie.data)||void 0===R||null===(N=R.config)||void 0===N?void 0:N.assistant_image)&&(0,Q.jsx)(a.Z,{src:null===(H=ie.data)||void 0===H||null===(O=H.config)||void 0===O?void 0:O.assistant_image,alt:"Bot",style:{margin:"10px 8px",border:"solid 1px #ccc"}}),(0,Q.jsx)("span",{style:{margin:"auto 0px",fontWeight:600,fontSize:"18px",color:"white",padding:null!==ie&&void 0!==ie&&null!==(W=ie.data)&&void 0!==W&&null!==(J=W.config)&&void 0!==J&&J.assistant_image?"inherit":"16px"},children:null===ie||void 0===ie?void 0:ie.name})]}),(0,Q.jsxs)(u.Z,{sx:{padding:"10px",overflow:"auto"},children:[(0,Q.jsx)(C.b,{text:null===(K=ie.data)||void 0===K||null===(L=K.config)||void 0===L||null===(P=L.input_template)||void 0===P?void 0:P.replaceAll("<a href","<a target='_blank' href")}),(0,Q.jsxs)("div",{style:{marginTop:10,height:oe||se?"30vh":"500px",overflow:"auto",display:"flex",flexDirection:"column",gap:10},id:"messages",children:[Ee.map((function(e,n){return(0,Q.jsx)(F,{message:e,index:n,app:ie,onInMessageFormSubmit:function(e){}},n)})),!He.current&&(0,Q.jsxs)("div",{style:{display:"flex",textAlign:"left",fontSize:16,padding:3},children:[(null===ie||void 0===ie||null===(q=ie.data)||void 0===q||null===(T=q.config)||void 0===T?void 0:T.assistant_image)&&(0,Q.jsx)(a.Z,{src:null===(V=ie.data)||void 0===V||null===(z=V.config)||void 0===z?void 0:z.assistant_image,alt:"Bot",style:{margin:"16px 8px 16px 0px"}}),(0,Q.jsxs)("div",{className:"chat_message_from_bot typing-indicator",children:[(0,Q.jsx)("span",{}),(0,Q.jsx)("span",{}),(0,Q.jsx)("span",{})]})]}),je&&(0,Q.jsx)(Z.D1,{runError:je}),0===Ee.filter((function(e){return"user"===e.role})).length&&(null===ie||void 0===ie||null===(X=ie.data)||void 0===X||null===(_=X.config)||void 0===_?void 0:_.suggested_messages)&&(null===ie||void 0===ie||null===($=ie.data)||void 0===$||null===(ee=$.config)||void 0===ee?void 0:ee.suggested_messages.length)>0&&(0,Q.jsx)(d.ZP,{sx:{alignSelf:"flex-end",textAlign:"right",marginTop:"auto"},children:null===ie||void 0===ie||null===(ne=ie.data)||void 0===ne||null===(te=ne.config)||void 0===te?void 0:te.suggested_messages.map((function(e,n){return(0,Q.jsx)(c.Z,{label:e,sx:{margin:"5px 2px"},onClick:function(){var n;return(null===ie||void 0===ie||null===(n=ie.input_fields)||void 0===n?void 0:n.length)>0&&We((0,i.Z)({},Object.keys(null===ie||void 0===ie?void 0:ie.input_fields)[0].name,e))}},n)}))})]}),(0,Q.jsx)(h.Z,{theme:Oe,children:(0,Q.jsx)(f.ZP,{formData:ge,schema:Ae,uiSchema:(0,s.Z)((0,s.Z)({},ue),{},{"ui:submitButtonOptions":{norender:Object.keys(null===Ae||void 0===Ae?void 0:Ae.properties).length<=1&&0===Object.keys(ue).map((function(e){var n;return null===(n=ue[e])||void 0===n?void 0:n["ui:widget"]})).filter((function(e){return"voice"===e})).length}}),validator:B.Z,onSubmit:function(e){var n=e.formData;Object.keys(null===Ae||void 0===Ae?void 0:Ae.properties).length>1&&he(n),We(n)},widgets:{FileWidget:y,voice:I}})}),se&&(0,Q.jsxs)("p",{style:{textAlign:"center"},children:["Powered by"," ",(0,Q.jsx)("a",{href:"https://trypromptly.com",target:"_blank",rel:"noreferrer",children:"Promptly"})]})]})]})]})}},979:function(e,n,t){t.d(n,{b:function(){return r}});var i=t(27135),o=(t(27369),t(80184));function r(e){var n=e.text,t=(new DOMParser).parseFromString(n,"text/html");return String(n).startsWith("<")?(0,o.jsx)("div",{className:"LexicalRenderer__wrapper",dangerouslySetInnerHTML:{__html:t.body.innerHTML}}):(0,o.jsx)(i.D,{children:n})}},67438:function(e,n,t){t.d(n,{H:function(){return a}});var i=t(45987),o=t(64554),r=t(20890),s=t(80184),l=["emptyImage","emptyMessage"];function a(e){var n=e.emptyImage,t=e.emptyMessage;(0,i.Z)(e,l);return(0,s.jsxs)(o.Z,{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"#838383",children:[n||null,(0,s.jsx)(r.Z,{variant:"h6",children:t||"No data available"})]})}},55100:function(e,n,t){var i=t(74165),o=t(15861),r=t(29439),s=t(72791),l=t(53767),a=t(13400),A=t(20890),u=t(64554),d=t(59001),c=t(85436),g=t(27247),h=t(80184);n.Z=function(e){var n=(0,s.useState)(!1),t=(0,r.Z)(n,2),p=t[0],B=t[1],f=(0,s.useState)(null),x=(0,r.Z)(f,2),m=x[0],v=x[1],E=(0,s.useState)(null),w=(0,r.Z)(E,2),C=w[0],Z=w[1],j=function(){var n=(0,o.Z)((0,i.Z)().mark((function n(){var t,o;return(0,i.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return C&&Z(null),n.prev=1,n.next=4,navigator.mediaDevices.getUserMedia({audio:!0});case 4:t=n.sent,(o=new MediaRecorder(t,{mimeType:"audio/webm"})).addEventListener("dataavailable",(function(n){var t=n.data;Z(t);var i=new window.FileReader;i.onload=function(n){var t;if("string"===typeof(null===(t=n.target)||void 0===t?void 0:t.result)){var i=n.target.result.split(";"),o="".concat(i[0],";name=").concat("audio_recording.webm",";").concat(i[2]);e.onChange(o)}else e.onChange(null)},i.readAsDataURL(t)})),o.start(),B(!0),v(o),n.next=15;break;case 12:n.prev=12,n.t0=n.catch(1),console.error("Error starting recording:",n.t0);case 15:case"end":return n.stop()}}),n,null,[[1,12]])})));return function(){return n.apply(this,arguments)}}(),Q=function(){m&&(m.stop(),B(!1))},y=function(){Z(null),e.onChange(null)},I=function(e){return(0,h.jsxs)(l.Z,{direction:"column",children:[(0,h.jsx)(a.Z,{onClick:j,color:"primary",size:"small",variant:"outlined",children:(0,h.jsx)(c.Z,{})}),(0,h.jsx)(A.Z,{style:{fontSize:"8px",textAlign:"center"},children:"Start"}),(0,h.jsx)(A.Z,{style:{fontSize:"8px",textAlign:"center"},children:"Recording"})]})},S=function(e){return(0,h.jsxs)(l.Z,{direction:"column",children:[(0,h.jsx)(a.Z,{onClick:Q,size:"small","aria-label":"Stop recording",variant:"outlined",children:(0,h.jsx)(d.Z,{})}),(0,h.jsx)(A.Z,{style:{fontSize:"8px",textAlign:"center",color:"red"},children:"Recording"})]})},F=function(e){return(0,h.jsxs)(l.Z,{direction:"column",ml:1,mr:1,children:[(0,h.jsx)(a.Z,{onClick:y,size:"small","aria-label":"Clear Recording",variant:"outlined",children:(0,h.jsx)(g.Z,{})}),(0,h.jsx)(A.Z,{style:{fontSize:"8px",textAlign:"center"},children:"Clear"}),(0,h.jsx)(A.Z,{style:{fontSize:"8px",textAlign:"center"},children:"Recording"})]})};return(0,h.jsxs)("div",{children:[(0,h.jsx)("label",{children:e.label}),(0,h.jsx)("div",{children:C?(0,h.jsxs)(l.Z,{direction:"row",children:[(0,h.jsx)("audio",{src:URL.createObjectURL(C),controls:!0}),(0,h.jsxs)(u.Z,{sx:{display:"flex",justifyContent:"space-between"},children:[(0,h.jsx)(F,{}),(0,h.jsx)(I,{})]})]}):p?(0,h.jsx)(S,{}):(0,h.jsx)(I,{})})]})}},72601:function(e,n,t){t.d(n,{P:function(){return r},_:function(){return s}});var i=t(29439),o=t(1413);function r(e,n){if(!e)return n;if(!n)return e;for(var t=(0,o.Z)({},e),s=0,l=Object.entries(n);s<l.length;s++){var a=(0,i.Z)(l[s],2),A=a[0],u=a[1];if(t[A])if(Array.isArray(u))if(Array.isArray(t[A]))for(var d=0;d<u.length;d++)if(d<t[A].length){if("string"===typeof u[d]){t[A][d]=t[A][d]+u[d];continue}if("number"===typeof u[d]){t[A][d]=u[d];continue}t[A][d]=r(t[A][d],u[d])}else t[A].push(u[d]);else t[A]=t[A]+u;else t[A]="object"===typeof u?r(t[A],u):t[A]+u;else t[A]=u}return t}function s(e){var n={type:"object",properties:{}},t={},i=[],o=[];return e&&e.forEach((function(e){var r,s;(i.push(e.name),e.required&&o.push(e.name),n.properties[e.name]={type:"text"===e.type||"voice"===e.type||"file"===e.type||"select"===e.type?"string":e.type,title:e.title,description:e.description},e.default&&(n.properties[e.name].default=e.default),"text"===e.type&&(t[e.name]={"ui:widget":"textarea"}),"boolean"===e.type&&(t[e.name]={"ui:widget":"radio"}),"file"===e.type&&(t[e.name]={"ui:widget":"file"},n.properties[e.name].format="data-url",n.properties[e.name].pattern="data:(.*);name=(.*);base64,(.*)"),"voice"===e.type&&(t[e.name]={"ui:widget":"voice"},n.properties[e.name].format="data-url",n.properties[e.name].pattern="data:(.*);name=(.*);base64,(.*)"),"select"===e.type)&&(t[e.name]={"ui:widget":"select"},n.properties[e.name].enum=null===(r=e.options)||void 0===r?void 0:r.map((function(e){return e.value})),n.properties[e.name].enumNames=null===(s=e.options)||void 0===s?void 0:s.map((function(e){return e.label})))})),t["ui:order"]=i,t["ui:required"]=o,{schema:n,uiSchema:t}}},61721:function(e,n,t){t.d(n,{Ws:function(){return r}});var i=t(15671),o=t(43144),r=function(){function e(n){(0,i.Z)(this,e),this.url=n,this.ws=null,this.onMessage=null,this.queue=[]}return(0,o.Z)(e,[{key:"status",value:function(){return this.ws.readyState}},{key:"connect",value:function(){var e=this;this.ws=new WebSocket(this.url),this.ws.onmessage=this.onMessage,this.ws.onopen=function(){e.queue.forEach((function(n){e.ws.send(n)})),e.queue=[]},this.ws.onclose=function(){console.log("Websocket closed")}}},{key:"send",value:function(e){null===this.ws&&this.connect(),this.ws.readyState===WebSocket.CONNECTING?this.queue.push(e):this.ws.readyState===WebSocket.OPEN?this.ws.send(e):(this.queue.push(e),this.connect())}},{key:"close",value:function(){this.ws.close()}},{key:"setOnMessage",value:function(e){this.onMessage=e}}]),e}()},27369:function(){}}]);
//# sourceMappingURL=4426.a4e33049.chunk.js.map